package org.andao.commons.taglib.ui;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.jsp.JspException;

import org.andao.commons.taglib.BaseTagSupport;
import org.andao.commons.template.FreeMarkerConfig;


import freemarker.template.Template;

/**
 * 图像采集标签.
 *  
 * @author Marco.hu(hzg139@163.com)
 */
public class WebcamTag extends BaseTagSupport{

	private static final long serialVersionUID = 8431163171440507878L;

	private String uploadurl ;//上传URL
	
	private String id ;//学生ID
	
	private String storePath;//存储路径
	
	private String replaceName;//替换文件名
	
	private String studentName;//学生姓名
	
	public int doStartTag() throws JspException {
		try {
			Template template = FreeMarkerConfig.getDefaultTemplate("taglib"+File.separator+"webcam.ftl");;
			Map root = getTemplateModelMap();
			root.put("basePath", getBaseUrl());
			root.put("uploadurl", uploadurl);
			root.put("id", id);
			root.put("storePath", storePath);
			root.put("replaceName", replaceName);
			root.put("studentName", studentName);
			template.process(root, super.pageContext.getOut());
		} catch (Exception e) {
			logger.error("输出图像采集出错：{}",e.fillInStackTrace());
		}
		return EVAL_PAGE;
	}

	/**
	 * @return the uploadurl
	 */
	public String getUploadurl() {
		return uploadurl;
	}

	/**
	 * @param uploadurl the uploadurl to set
	 */
	public void setUploadurl(String uploadurl) {
		this.uploadurl = uploadurl;
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the storePath
	 */
	public String getStorePath() {
		return storePath;
	}

	/**
	 * @param storePath the storePath to set
	 */
	public void setStorePath(String storePath) {
		this.storePath = storePath;
	}

	/**
	 * @return the replaceName
	 */
	public String getReplaceName() {
		return replaceName;
	}

	/**
	 * @param replaceName the replaceName to set
	 */
	public void setReplaceName(String replaceName) {
		this.replaceName = replaceName;
	}

	/**
	 * @return the studentName
	 */
	public String getStudentName() {
		return studentName;
	}

	/**
	 * @param studentName the studentName to set
	 */
	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	
	
	
	
}
